package farmers.http;

import farmers.io.WriteUtil;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class HttpTest {



    public static void main( String[] args )

    {

        try{

            String content = "A cat will append to the end of the file";

            File file =new File("d:/1.html");

            if(!file.exists()){
                file.createNewFile();
            }

            //使用true，即进行append file

            FileWriter fileWritter = new FileWriter(file.getName(),true);


            fileWritter.write(content);

            fileWritter.close();

            System.out.println("finish");

        }catch(IOException e){

            e.printStackTrace();

        }

    }



    public static void main2(String[] args) {
        String tonghuashun = "https://mp.weixin.qq.com/s/Wh8UqpkauZ-fWBtnL8-_bw";

        String result = HttpClient.doGet(tonghuashun);
        System.out.println(result);

        WriteUtil.appendContent("result", "d:/1.html");


    }
}
